﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.SqlClient;

namespace tp
{
    public partial class _finally : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Userguanli"] != null)
            {
                string strnoe;
                strnoe = (string)Session["Userguanli"];
                string strCn = "Data Source=pc.hstc.cn;Initial Catalog=dhd2014112142;User ID=2014112142;Password=19961124";
                SqlConnection cn = new SqlConnection(strCn);
                try
                {
                    cn.Open();
                    string strSql = "SELECT  No,Name,Age,College,Birth,Iden,Addr  FROM Infomation  WHERE(Name =N'" + strnoe + "')";
                    SqlCommand cmd = new SqlCommand(strSql, cn);
                    SqlDataReader dr = cmd.ExecuteReader();//ExecuteReader是一个对象，需要重新定义对象
                    this.GridView1.DataSource = dr;
                    this.GridView1.DataBind();
                    dr.Close();
                }
                catch (Exception ex)
                {
                    this.lbl.Text = ex.Message;
                }
                finally
                {
                    cn.Close();
                }
            }
        }

        protected void ddlhuanfu_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
        protected void Page_PreInit(object sender, EventArgs e)
        {
            if (Request.QueryString["Theme"] != null)
                Page.Theme = Request.QueryString["Theme"].ToString();

        }
        protected void ibhuanfu_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("finally.aspx?Theme=" + ddlhuanfu.SelectedValue + "");
        }
    }
}